#if (FEATURE_MODE == 0)
/**
 @file ctc_greatbel_bpe_cli.c

 @date 2012-04-06

 @version v2.0

---file comments----
*/

/****************************************************************
 *
 * Header Files
 *
 ***************************************************************/
#include "ctc_cli.h"
#include "ctc_cli_common.h"
#include "ctc_error.h"
#include "ctc_api.h"
#include "ctcs_api.h"
#include "ctc_debug.h"

int32
sys_usw_bpe_get_port_extend_mcast_en(uint8 lchip, uint8 *p_enable);

int32
sys_usw_bpe_set_port_extend_mcast_en(uint8 lchip, uint8 enable);

int32
sys_usw_bpe_get_port_extender(uint8 lchip, uint32 gport, uint32* p_enable, uint8 dir, uint8 is_pmac);

CTC_CLI(ctc_cli_usw_bpe_control_bridge_mcast_en,
        ctc_cli_usw_bpe_control_bridge_mcast_en_cmd,
        "bpe control-bridge mcast (enable|disable)",
        CTC_CLI_BPE_M_STR,
        "Control bridge",
        "Mcast",
        CTC_CLI_ENABLE,
        CTC_CLI_DISABLE
        )
{
    uint8 enable = 0;
    uint8 index = 0;
    int32 ret = CLI_SUCCESS;

    index = CTC_CLI_GET_ARGC_INDEX_ENHANCE("enable");

    if (index != 0xFF)
    {
        enable = 1;
    }
    else
    {
        enable = 0;
    }

    ret = sys_usw_bpe_set_port_extend_mcast_en(g_api_lchip, enable);

    if (0 != ret)
    {
        ctc_cli_out("%% set nexthop cb-mcast fail\n");
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_bpe_show_control_bridge_mcast_en,
        ctc_cli_usw_bpe_show_control_bridge_mcast_en_cmd,
        "show bpe control-bridge mcast (enable|disable)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_BPE_M_STR,
        "Control bridge",
        "Mcast",
        CTC_CLI_ENABLE,
        CTC_CLI_DISABLE
        )
{
    uint8 enable = 0;
    int32 ret = CLI_SUCCESS;

    ret = sys_usw_bpe_get_port_extend_mcast_en(g_api_lchip, &enable);

    if (0 != ret)
    {
        ctc_cli_out("%% set bpe control bridge mcast fail\n");
    }
    else
    {
        if (enable)
        {
            ctc_cli_out("%% bpe control bridge mcast enable.\n");
        }
        else
        {
            ctc_cli_out("%% bpe control bridge mcast disable.\n");
        }
    }

    return ret;
}

CTC_CLI(ctc_cli_usw_bpe_show_bpe,
        ctc_cli_usw_bpe_show_bpe_cmd,
        "show bpe port GPHYPORT_ID direction DIR (is-pmac|)",
        CTC_CLI_SHOW_STR,
        CTC_CLI_BPE_M_STR,
        CTC_CLI_PORT_M_STR,
        CTC_CLI_GPHYPORT_ID_DESC,
        "Direction",
        "Direction value, 0: both, 1: ingress, 2: egress",
        "Set pmac or emac channel when xpipe enable default is emac"
        )
{
    int32 ret = 0;
    uint32 gport = 0;
    uint32 enable = 0;
    uint8 dir = 0;
    uint8 is_pmac = 0;
    uint8 index = 0 ;

    index = CTC_CLI_GET_ARGC_INDEX("is-pmac");
    if (0xFF != index)
    {
        is_pmac = 1;
    }



    CTC_CLI_GET_UINT32("gport", gport, argv[0]);
    CTC_CLI_GET_UINT8("direction value", dir, argv[1]);

    ret = sys_usw_bpe_get_port_extender(g_api_lchip, gport, &enable, dir, is_pmac);
    if (ret < 0)
    {
        ctc_cli_out("%% ret = %d, %s \n", ret, ctc_get_error_desc(ret));
        return CLI_ERROR;
    }

    ctc_cli_out("bpe  -enable               :%d\n", enable?1:0);

    return CLI_SUCCESS;
}

int32
ctc_usw_bpe_cli_init(void)
{
    install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_control_bridge_mcast_en_cmd);
    install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_show_control_bridge_mcast_en_cmd);
    install_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_show_bpe_cmd);

    return CLI_SUCCESS;
}

int32
ctc_usw_bpe_cli_deinit(void)
{
    uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_control_bridge_mcast_en_cmd);
    uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_show_control_bridge_mcast_en_cmd);
    uninstall_element(CTC_INTERNAL_MODE, &ctc_cli_usw_bpe_show_bpe_cmd);

    return CLI_SUCCESS;
}

#endif

